Create Receipt
The "Create Receipt" process is designed for scenarios where generating an individual invoice for every transaction is not feasible, such as in B2C (Business-to-Consumer) transactions. This is particularly applicable to businesses like supermarkets, retail stores, or any high-volume consumer-facing business where numerous transactions occur daily.
In a typical B2C flow, individual consumers make frequent, small-scale purchases, often without the need for a detailed e-invoice to be generated at the point of sale. For example, in a supermarket, thousands of customers may purchase items daily. Generating an individual e-invoice for every single transaction would be cumbersome and inefficient.
Instead, you can simply issue receipts to customers during the day to document their purchases. These receipts serve as proof of transaction for the customer, without needing to send each one to the tax authorities immediately.
At the end of the day (or a specified period), the receipts are consolidated, and you can generate a single e-invoice summarizing all the transactions made during that period. This e-invoice is then sent to the government or relevant tax authorities to fulfill compliance requirements.
Key Benefits of This Approach:
- Efficiency: You don’t need to generate and submit an e-invoice for every individual B2C transaction. Instead, receipts are created instantly, while the e-invoice can be generated in bulk later.
- Compliance: At the end of each day (or another specified interval), a consolidated e-invoice ensures that the business meets legal requirements without overwhelming the system with each transaction.
- Customer Satisfaction: Receipts are generated quickly for customers at checkout, ensuring a smooth transaction process, while the business remains compliant with e-invoicing regulations.
This flow is particularly useful for businesses with a high volume of low-value transactions, as it simplifies operations while still ensuring proper tax reporting and compliance.
This API allows you to create a receipt by sending the required data in JSON format using a POST
request. Below is the detailed documentation of the API endpoint and how to use the cURL command.
e-Invoice Types
Code | Examples | Acceptable Values |
---|---|---|
01 | Invoice | INV |
02 | Credit Note | CRD |
03 | Debit Note | DBT |
04 | Refund Note | RFD |
11 | Self-billed Invoice | SLF_INV |
12 | Self-billed Credit Note | SLF_CRD |
13 | Self-billed Debit Note | SLF_DBT |
14 | Self-billed Refund Note | SLF_REF |
API Endpoint
Method: POST
URL: https://malaysia-sandbox.complyance.io/createReciept
Headers
Header Name | Value | Description |
---|---|---|
x-api-key | k4PW_J0s8DtBSdvYnadXn | API key to authorize the request |
Content-Type | application/json | Specifies that the request body is in JSON format |
- Shell
- Javascript
- Ruby
- Python
- PHP
- Java
- Go
curl --location 'https://malaysia-sandbox.complyance.io/createReciept \
--header 'x-api-key: k4PW_J0s8DtBSdvYnadXn' \
--header 'Content-Type: application/json'
const headers = {
'x-api-key': 'k4PW_J0s8DtBSdvYnadXn',
'Content-Type': 'application/json'
};
fetch('https://malaysia-sandbox.complyance.io/createReciept', {
method: 'POST',
headers: headers
})
.then(function(response) {
return response.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
headers = {
'x-api-key' => 'k4PW_J0s8DtBSdvYnadXn',
'Content-Type' => 'application/json'
}
response = RestClient.post 'https://malaysia-sandbox.complyance.io/createReciept', {}, headers
puts response.body
import requests
headers = {
'x-api-key': 'k4PW_J0s8DtBSdvYnadXn',
'Content-Type': 'application/json'
}
response = requests.post('https://malaysia-sandbox.complyance.io/createReciept', headers=headers)
print(response.json())
<?php
$headers = [
'x-api-key' => 'k4PW_J0s8DtBSdvYnadXn',
'Content-Type' => 'application/json'
];
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://malaysia-sandbox.complyance.io/createReciept', [
'headers' => $headers
]);
echo $response->getBody()->getContents();
?>
URL url = new URL("https://malaysia-sandbox.complyance.io/createReciept");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("x-api-key", "k4PW_J0s8DtBSdvYnadXn");
con.setRequestProperty("Content-Type", "application/json");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"net/http"
)
func main() {
headers := map[string][]string{
"x-api-key": []string{"k4PW_J0s8DtBSdvYnadXn"},
"Content-Type": []string{"application/json"},
}
req, err := http.NewRequest("POST", "https://malaysia-sandbox.complyance.io/createReciept", nil)
if err != nil {
// Handle error
}
for key, values := range headers {
for _, value := range values {
req.Header.Add(key, value)
}
}
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
// Handle error
}
defer resp.Body.Close()
}
Request Body
The request body should be sent as a JSON array containing receipt information. Below is the structure of the JSON data:
[
{
"receiptDataList": [
{
"documentType": "INV",
"recieptNumber": "E-Invoice -10",
"mobileNumber": "+917860720590",
"originalEInvoiceReferenceNumber": "xyz",
"recieptIssueDate": "2024-12-04",
"documentIssueTime": "02:30:00Z",
"currency": "MYR",
"currencyExchangeRate": "1",
"supplierId": "1",
"sellerTinNumber": "C58794843040",
"sellerRegistrationIdType": "BRN",
"sellerRegistrationId": "198801006871",
"supplierSstRegistrationNumber": "",
"supplierTourismTaxRegistrationNumber": "",
"isShippingAndBuyerAddressSame": true,
"totalExcludingTax": "1000",
"taxTotal": "60",
"totalTaxableAmount":"",
"documentTotal": "1060",
"totalPayableAmount": "1060",
"paymentMeans": "",
"sellerAddress": {
"addressLine1": "Lot 66",
"addressLine2": "Bangunan Merdeka",
"addressLine3": "Persiaran Jaya",
"postalCode": "",
"city": "Kuala Lumpur",
"state": "PERLIS",
"country": "MYS"
},
"supplierDetails": {
"organizationName": "Name of Supplier",
"email": "email@supplier.com",
"industryCode": "01111",
"industryDescription": "Growing of maize",
"phoneNumber": "+60-123456789"
},
"documentLineItems": [
{
"lineItemId": "1",
"commodityClassificationCode": "1",
"description": "BOP JETTING SUB, SLEEVE, 8\", REV E, BJS-8000-002 (BJS-8000-002-E)",
"unitPrice": "100",
"quantity": "10",
"lineItemSubtotal": "1000",
"discountPercent": "0",
"discountAmount": "0",
"chargePercent": "0",
"chargeAmount": "0",
"lineTotalExcludingTax": "1000",
"taxType": "1",
"taxPercentage": "6",
"totalTax": "60",
"taxExemptionReason": "Goods acquired with SST exemption under Sales Tax Act 2018. Reference No: (C01-2345-67890123)",
"amountExemptedFromTax": "0",
"lineItemTotal": "1000"
}
]
}
]
}
]
cURL Command
Command Part | Description |
---|---|
curl --location | Specifies the URL and method (POST request). |
'https://malaysia.complyance.io/dev/createReciept' | API endpoint URL for receipt creation. |
--header 'x-api-key: k4PW_J0s8DtBSdvYnadXn' | Provides the API key for authentication. |
--header 'Content-Type: application/json' | Specifies that the content type is JSON. |
--data '...' | Sends the JSON body data as specified above. |
Request Parameter Fields
Invoice Details
ObjectName | Field Name | Conditionality | Informatics | Field Max Length | Sample Value |
---|---|---|---|---|---|
Invoice Details | |||||
documentType | e-Invoice Type Code | Mandatory | Identifies the document type (e.g., INV, CRD, DBT, RFD) | 2 | INV |
recieptNumber | Receipt Reference Number | Mandatory | String: Receipt reference number used by Supplier for internal tracking purpose | 50 | test6 |
recieptIssuedate | Receipt Issuance Date | Mandatory | String: Date of issuance of the receipt (Note that the date must be the current date) | 10 | 2024-08-15 |
mobileNumber | Mobile Number | Mandatory | String: Mobile number used for converting the receipt to an e-Invoice | 15 | +609390164128 |
currency | Invoice Currency Code | Mandatory | Specific currency that is used to represent the monetary value stated in the e-Invoice | 3 | MYR |
currencyExchangeRate | Currency Exchange Rate | Optional | The exchange rate between the local currency and foreign currency | 10 | 1 |
invoiceFrequency | Frequency of Billing | Optional | Frequency of the invoice (e.g., Daily, Weekly, Monthly) | 50 | Monthly |
invoiceStartDate | Billing Period Start Date | Optional | Start date of the transaction | 10 | 2024-08-19 |
invoiceEndDate | Billing Period End Date | Optional | End date of the transaction interval | 10 | 2024-08-23 |
Supplier Details
ObjectName | Field Name | Conditionality | Informatics | Field Max Length | Sample Value |
---|---|---|---|---|---|
Supplier Details | |||||
supplierId | Supplier ID | optional | Identification Number of a Specific Supplier in an Invoice | 20 | 1 |
supplierName | Supplier’s Name | Mandatory | Name of business or individual who will be the issuer of the e-Invoice in a commercial transaction | 300 | sellerName |
sellerTinNumber | Supplier’s TIN | Mandatory | Supplier’s (i.e., issuer’s) TIN assigned by IRBM | 14 | C21540299050 |
sellerRegistrationIdType | Supplier’s Registration scheme ID | Mandatory | Business registration number / MyKad / Passport number depending on entity | 12 | BRN |
sellerRegistrationId | Supplier’s Registration Number | Mandatory | Supplier’s business registration or identification number | 20 | BRN: 202001234567 |
supplierSstRegistrationNumber | SST Registration Number | Mandatory | Sales tax / service tax (SST) registration number of the Supplier (SST-registrant) | 20 | A01-2345-67891012 |
supplierTourismTaxRegistrationNumber | Tourism Tax Registration Number | Optional | Tourism tax registration number of the Supplier | 20 | 123-4567-89012345 |
supplierDetails.organizationName | Supplier’s Name | Mandatory | Organization name of the supplier | 300 | Name of Supplier |
supplierDetails.email | Supplier’s e-mail | Optional | E-mail address of the Supplier | 320 | email@supplier.com |
supplierDetails.industryCode | Supplier’s MSIC Code | Mandatory | 5-digit numeric code representing the Supplier’s business nature and activity | 5 | 01111 |
supplierDetails.industryDescription | Supplier’s Business Activity Description | Mandatory | Description of the Supplier’s business activity | 300 | Growing of maize |
supplierDetails.phoneNumber | Supplier’s Contact Number | Mandatory | The telephone number of the Supplier | 15 | +60-123456789 |
Supplier’s Address
ObjectName | Field Name | Conditionality | Informatics | Field Max Length | Sample Value |
---|---|---|---|---|---|
sellerAddress.addressLine1 | Address Line 1 | Mandatory | The main address line in an address structure. Input "NA" if unavailable | 150 | Lot 66 |
sellerAddress.addressLine2 | Address Line 2 | Optional | An additional address line for further details | 150 | Bangunan Merdeka |
sellerAddress.addressLine3 | Address Line 3 | Optional | An additional address line for further details | 150 | Persiaran Jaya |
sellerAddress.postalCode | Postal Zone | Optional | The identifier for a postal zone | 50 | 50480 |
sellerAddress.city | City Name | Mandatory | The common name of the city | 50 | Kuala Lumpur |
sellerAddress.state | State | Mandatory | The state of a country | 50 | 11 |
sellerAddress.country | Country | Mandatory | A code identifying the country | 3 | MYS |
Invoice Line Item
ObjectName | Field Name | Conditionality | Informatics | Field Max Length | Sample Value |
---|---|---|---|---|---|
documentLineItems.lineItemId | Line ID | Mandatory | Identification of a Specific Line in an Invoice | 20 | 1 |
documentLineItems.commodityClassificationCode | Classification | Mandatory | Category of products or services being billed | 3 | 1 |
documentLineItems.productTariffCode | Tariff Code | Mandatory | Product or service classification code based on tariff | 9800.00.0010 | |
documentLineItems.description | Description of Product or Service | Mandatory | Details of products or services being billed | 300 | Laptop Peripherals |
documentLineItems.unitPrice | Unit Price | Mandatory | Price assigned to a single unit of a product or service | 100 | |
documentLineItems.quantity | Quantity | Mandatory | Number of units of a product or service | 10 | |
documentLineItems.lineItemSubtotal | Subtotal | Mandatory | Amount of each individual item, excluding any taxes or charges | 1000 | |
documentLineItems.taxType | Tax Type | Mandatory | Type of taxes that will be applicable | 2 | 1 |
documentLineItems.taxPercentage | Tax Rate | Mandatory | The appropriate tax rate that is applicable | 6 | |
documentLineItems.totalTax | Tax Amount | Mandatory | The amount of tax payable | 60 | |
documentLineItems.taxExemptionReason | Tax Exemption Reason | Optional | Description of tax exemption applicable | 300 | Goods acquired with SST exemption |
documentLineItems.amountExemptedFromTax | Amount Exempted from Tax | Optional | Total amount of tax exempted | 0 |
Response
Success Response
Upon successful receipt creation, the API will return a success message along with the receipt details.
{
"errorMessages": {
"0": {
"receiptDataList[0]-supplierDetails-phoneNumber": "supplier's mobile number is mandatory- Please provide a valid mobile number",
"receiptDataList[0]-lineItems[0]-description": "Line item description cannot be empty",
"receiptDataList[0]-documentTotal": "documentTotal cannot be empty",
"receiptDataList[0]-lineItems[0]-lineItemTotal": "Line item total cannot be null",
"receiptDataList[0]-totalPayableAmount": "totalPayableAmount cannot be empty"
}
},
"batchId": null,
"errorCode": null
}
Sample Error Response
In case of any errors, the API will return an appropriate error message.
{
"errorsList": [
{
"errors": [
{
"invoiceDataList[0]-sellerTinNumber": "sellerTinNumber should not Exceed 14 digits ex:'A04512299050'"
},
{
"invoiceDataList[0]-currency": "currency cannot be empty"
},
{
"invoiceDataList[0]-recieptIssuedate": "recieptIssuedate cannot be empty"
},
{
"invoiceDataList[0]-invoiceEndDate": "InvoiceEndDate should be after to invoiceStartDate"
},
{
"invoiceDataList[0]-buyerTinNumber": "buyerTinNumber should not Exceed 14 digits ex:'A04512299050'"
}
]
}
]
}
The API may return the following success responses depending on the validation result or submission status:
Status Code | Description |
---|---|
200 | Success – The request was processed successfully. |
202 | Accepted – The request has been accepted but is still processing. |
Notes
- Ensure the
x-api-key
is valid, or the request will fail with an authentication error. - Verify that all required fields are properly formatted, especially dates and tax information.